#ifndef UPPER_HPP
#define UPPER_HPP

#include <alice/alice.hpp>


#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>


namespace alice
{
ALICE_ADD_STORE( std::string, "str", "s", "string", "strings" )

ALICE_PRINT_STORE( std::string, os, element )
{
  os << element << std::endl;
}
ALICE_ADD_FILE_TYPE(txt,"txt")

ALICE_READ_FILE( std::string, txt, filename, cmd )
{
  std::ifstream in( filename.c_str(), std::ifstream::in );
  std::stringstream buffer;
  buffer << in.rdbuf();
  return buffer.str();
}

ALICE_WRITE_FILE( std::string, txt, element, filename, cmd )
{
  std::ofstream out( filename.c_str(), std::ofstream::out );
  out << element;
}

ALICE_COMMAND(upper , "test","test read and write command in alice")
{
	auto& str = store<std::string>().current();
	std::transform( str.begin(), str.end(), str.begin(), ::toupper );
}
}


#endif
